from playwright.sync_api import Playwright, sync_playwright, expect


def run(playwright: Playwright) -> None:
    browser = playwright.chromium.launch(headless=False)
    context = browser.new_context()
    page = context.new_page()
    page.goto("http://127.0.0.1:34009/xxl-job-admin/toLogin")
    page.get_by_placeholder("请输入登录账号").click()
    page.get_by_placeholder("请输入登录账号").fill("admin")
    page.get_by_placeholder("请输入登录密码").click()
    page.get_by_placeholder("请输入登录密码").fill("123456")
    page.get_by_role("button", name="登录").click()

    # 打断点
    page.pause()

    # ---------------------
    context.close()
    browser.close()


with sync_playwright() as playwright:
    run(playwright)
